﻿@{
Book book = ViewData["book"] as Book;
Chapter nextChapter = ViewData["next_chapter"] as Chapter;
Chapter lastChapter = ViewData["last_chapter"] as Chapter;
ViewData["Title"] = $"{Model.ChapterName}";
}
@model Chapter
<style>
    pre {
        white-space: pre-wrap; /* 允许自动换行 */
        word-wrap: break-word; /* 在长单词或URL内部进行换行 */
    }
</style>

<div class="row">
    <div class="col-md-12">
        <h1 class="text-center"><a asp-action="TxtBookChapter" asp-controller="Book" asp-route-bookId="@book.Id">@book.Title</a></h1>
        <h2 class="text-center">@Model.ChapterName</h2>
        <p><pre style="font-size: 30px;">@Model.Content</pre></p>
    </div>
</div>
<div class="row mt-4">
    <div class="col-md-12">
        <div class="text-center">
            @if (lastChapter != null)
            {
                <a asp-controller="Book" asp-action="TxtBookContent" asp-route-chapterId="@lastChapter.ChapterId" class="btn btn-primary">上一章</a>
            }
            @if (nextChapter != null)
            {
                <a asp-controller="Book" asp-action="TxtBookContent" asp-route-chapterId="@nextChapter.ChapterId" class="btn btn-primary">下一章</a>
            }
        </div>
    </div>
</div>